package main

import "fmt"

type IPlayer interface {
	train()
}

type DefaultPlayer struct {
	name string
}

func (defaultPlayer *DefaultPlayer) train() {
	fmt.Println("默认训练动作")
}

func (defaultPlayer *DefaultPlayer) sign(player IPlayer) {
	fmt.Println(defaultPlayer.name, "签到")
	player.train()
}

type FootballPlayer struct {
	DefaultPlayer
}

func (footballPlayer *FootballPlayer) train() {
	fmt.Println("足球运动员开始训练")
}

type BasketballPlayer struct {
	DefaultPlayer
}

func (basketballPlayer *BasketballPlayer) train() {
	fmt.Println("篮球运动员开始训练")
}

type SwimmingPlayer struct {
	DefaultPlayer
}

func (swimmingPlayer *SwimmingPlayer) train() {
	fmt.Println("游泳运动员开始训练")
}

func main6() {
	footballPlayer := &FootballPlayer{DefaultPlayer{"A"}}
	footballPlayer.sign(footballPlayer)

	basketballPlayer := &BasketballPlayer{DefaultPlayer{"B"}}
	basketballPlayer.sign(basketballPlayer)

	swimmingPlayer := &SwimmingPlayer{DefaultPlayer{"C"}}
	swimmingPlayer.sign(swimmingPlayer)
}
